Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.1] Remote: Don't upload action result if declared outputs are not created. #15050

Conversation

brentleyjones
Copy link
Contributor

@brentleyjones brentleyjones commented Mar 15, 2022

Even if the exit code is 0. Missing declared outputs will be detected by Bazel later and fail the build, so avoid uploading this false positive cache entry.

Wrap buildUploadManifest inside a Single.fromCallable since there are many IOs (both the check we add in this PR and stats already there). If --experimental_remote_cache_async is set, these IOs will now be executed in a background thread.

(cherry picked from commit 5b54588)

Also:

Remote: Check declared outputs when downloading outputs.

An AC entry that misses declared outputs of an action is invalid because, if Bazel accepts this from remote cache, it will detect the missing declared outputs error at a later stage and fail the build.

This PR adds a check for mandatory outputs when downloading outputs from remote cache. If a mandatory output is missing from AC entry, Bazel will ignore the cache entry so build can continue.

Also fixes an issue introduced by #15016 that tests result are not uploaded to remote cache. Test spawns declare all the possible outputs but they usually don't generate them all. This change fixes that by only check for mandatory outputs via spawn.isMandatoryOutput().

Fixes #14543.

(cherry picked from commit a151116)

Even if the exit code is 0. Missing declared outputs will be detected by Bazel later and fail the build, so avoid uploading this false positive cache entry.

Wrap buildUploadManifest inside a `Single.fromCallable` since there are many IOs (both the check we add in this PR and stats already there). If `--experimental_remote_cache_async` is set, these IOs will now be executed in a background thread.

Fixes bazelbuild#14543.

Closes bazelbuild#15016.

PiperOrigin-RevId: 434448255
(cherry picked from commit 5b54588)
@brentleyjones brentleyjones requested a review from a team as a code owner March 15, 2022 12:57
@brentleyjones
Copy link
Contributor Author

@Wyverald

@brentleyjones brentleyjones marked this pull request as draft March 15, 2022 15:51
@brentleyjones
Copy link
Contributor Author

#15016 (comment)

An AC entry that misses declared outputs of an action is invalid because, if Bazel accepts this from remote cache, it will detect the missing declared outputs error at a later stage and fail the build.

This PR adds a check for mandatory outputs when downloading outputs from remote cache. If a mandatory output is missing from AC entry, Bazel will ignore the cache entry so build can continue.

Also fixes an issue introduced by bazelbuild#15016 that tests result are not uploaded to remote cache. Test spawns declare all the possible outputs but they usually don't generate them all. This change fixes that by only check for mandatory outputs via `spawn.isMandatoryOutput()`.

Fixes bazelbuild#14543.

Closes bazelbuild#15051.

PiperOrigin-RevId: 435307260
(cherry picked from commit a151116)
@brentleyjones brentleyjones marked this pull request as ready for review March 17, 2022 13:03
@brentleyjones brentleyjones marked this pull request as draft March 17, 2022 13:06
@brentleyjones
Copy link
Contributor Author

Seems we need 82b3896, but that doesn't apply cleanly. @coeuvre can you submit a cheery-pick that has these changes for 5.1?

@coeuvre
Copy link
Member

coeuvre commented Mar 18, 2022

Created #15071.

@coeuvre coeuvre closed this Mar 18, 2022
@brentleyjones brentleyjones deleted the bj/remote-don-t-upload-action-result-if-declared-outputs-are-not-created branch March 18, 2022 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants